<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--

Copyright (c) 2006, Sun Microsystems, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the Sun Microsystems, Inc. nor the names of its
      contributors may be used to endorse or promote products derived from
      this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.

-->
<head>
 <title>JavaCC Features</title>
<!-- Changed by: Michael Van De Vanter, 14-Jan-2003 -->
</head>
<body bgcolor="#FFFFFF" >

<h1>JavaCC [tm]: Features</h1>
<p>
JavaCC [tm] is a Java parser generator written in the Java programming language.  It produces pure
Java code.  Both JavaCC and the parsers generated by JavaCC have been
run on a variety of Java platforms.  JavaCC comes with a bunch of
grammars including Java 1.0.2, Java 1.1, and Java 2 as well as a couple
of HTML grammars.
</p>
<p>
Specific features of JavaCC are listed below:
</p>
<ul>
<li>
TOP-DOWN: JavaCC generates top-down (recursive descent) parsers as
opposed to bottom-up parsers generated by YACC-like tools.  This
allows the use of more general grammars (although left-recursion is
disallowed).  Top-down parsers have a bunch of other advantages
(besides more general grammars) such as being easier to debug,
having the ability to parse to any non-terminal in the grammar, and also having the
ability to pass values (attributes) both up and down the parse
tree during parsing.
</li>
<li>
LARGE USER COMMUNITY: JavaCC is by far the most popular parser
generator used with Java applications.  We've had over hundreds of
thousands of downloads and estimate serious users in the many thousands
(maybe even tens of thousands).  Our <a href="mailinglist.html">mailing
list</a> and newsgroups together have a few thousand participants.
</li>
<li>
LEXICAL AND GRAMMAR SPECIFICATIONS IN ONE FILE: The lexical
specifications such as regular expressions, strings, etc. and the
grammar specifications (the BNF) are both written together in the same
file.  It makes grammars easier to read (since it is possible to use
regular expressions inline in the grammar specification) and also
easier to maintain.
</li>
<li>
TREE BUILDING PREPROCESSOR:  JavaCC comes with JJTree, an extremely
powerful tree building preprocessor.
</li>
<li>
EXTREMELY CUSTOMIZABLE: JavaCC offers many different options to
customize its behavior and the behavior of the generated parsers.
Examples of such options are the kinds of Unicode processing to
perform on the input stream, the number of tokens of ambiguity
checking to perform, etc. etc.
</li>
<li>
CERTIFIED TO BE 100% PURE JAVA:  JavaCC runs on all Java compliant
platforms Version 1.1 or later.  It has been used on countless different
machines with no special porting effort - a testimonial to the
"Write Once, Run Everywhere" aspect of the Java [tm] programming language.
</li>
<li>
DOCUMENT GENERATION: JavaCC includes a tool called JJDoc that
converts grammar files to documentation files (optionally in html).
</li>
<li>
MANY MANY EXAMPLES:  The JavaCC release includes a wide range of
examples including Java and HTML grammars.  The examples, along with
their documentation, are a great way to get acquainted with JavaCC.
</li>
<li>
INTERNATIONALIZED: The lexical analyzer of JavaCC can handle full
Unicode input, and lexical specifications may also include any
Unicode character.  This facilitates descriptions of language elements
such as Java identifiers that allow certain Unicode characters (that are
not ASCII), but not others.
</li>
<li>
SYNTACTIC AND SEMANTIC LOOKAHEAD SPECIFICATIONS: By default, JavaCC
generates an LL(1) parser.  However, there may be portions of the grammar
that are not LL(1).  JavaCC offers the capabilities of syntactic and
semantic lookahead to resolve shift-shift ambiguities locally at these
points.  For example, the parser is LL(k) only at such points, but remains LL(1)
everywhere else for better performance.  Shift-reduce and reduce-reduce
conflicts are not an issue for top-down parsers.
</li>
<li>
PERMITS EXTENDED BNF SPECIFICATIONS: JavaCC allows extended BNF
specifications - such as <code>(A)*</code>, <code>(A)+</code>, etc. - within the lexical and
the grammar specifications.  Extended BNF relieves the need for
left-recursion to some extent.  In fact, extended BNF is often easier
to read as in <code>A ::= y(x)*</code> versus <code>A ::= Ax|y</code>.
</li>
<li>
LEXICAL STATES AND LEXICAL ACTIONS:  JavaCC offers <I>lex</I>-like lexical
state and lexical action capabilities.  Specific aspects in JavaCC
that are superior to other tools are the first class status it offers
concepts such as TOKEN, MORE, SKIP, state changes, etc.  This allows
cleaner specifications as well as better error and warning messages
from JavaCC.
</li>
<li>
CASE-INSENSITIVE LEXICAL ANALYSIS:  Lexical specifications can define
tokens not to be case sensitive either at the global level for the
entire lexical specification, or on an individual lexical specification
basis.
</li>
<li>
EXTENSIVE DEBUGGING CAPABILITIES:  Using options DEBUG_PARSER,
DEBUG_LOOKAHEAD, and DEBUG_TOKEN_MANAGER, one can get in-depth analysis
of the parsing and the token processing steps.
</li>
<li>
SPECIAL TOKENS: Tokens that are defined as special tokens in the
lexical specification are ignored during parsing, but these tokens
are available for processing by the tools.  A useful application of
this is in the processing of comments.
</li>
<li>
VERY GOOD ERROR REPORTING:  JavaCC error reporting is among the best in
parser generators.  JavaCC generated parsers are able to clearly point
out the location of parse errors with complete diagnostic information.
</li>
</ul>

</body>
</html>
